<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>微信绑定 - 记账助手</title>
    <link rel="stylesheet" href="styles.css">
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
    <script src="https://cdn.jsdelivr.net/npm/jquery@3.6.0/dist/jquery.min.js"></script>
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
</head>
<body>
    <div class="screen">
        <div class="app-container">
            <div class="auth-container">
                <div class="auth-logo">💰</div>
                <h1 class="auth-title">绑定微信账号</h1>
                
                <!-- 微信用户信息展示 -->
                <div class="wechat-user-info">
                    <div class="wechat-avatar">
                        <img id="wechat-avatar" src="" alt="微信头像">
                    </div>
                    <div class="wechat-nickname" id="wechat-nickname">微信用户</div>
                    <div class="bind-tip">检测到您还未绑定记账助手账号</div>
                </div>
                
                <!-- 绑定选项 -->
                <div class="bind-options">
                    <div class="bind-option">
                        <h3>已有账号？</h3>
                        <p>登录现有账号即可自动绑定微信</p>
                        <button class="btn btn-primary" id="login-bind-btn">登录并绑定</button>
                    </div>
                    
                    <div class="divider">或</div>
                    
                    <div class="bind-option">
                        <h3>还没有账号？</h3>
                        <p>注册新账号后自动绑定微信</p>
                        <button class="btn btn-outline" id="register-bind-btn">注册并绑定</button>
                    </div>
                </div>
                
                <div class="auth-footer">
                    <a href="login.html" class="auth-link">返回登录页面</a>
                </div>
            </div>
        </div>
    </div>

    <script>
        // 页面加载时获取微信用户信息
        document.addEventListener('DOMContentLoaded', function() {
            const wechatUserInfo = sessionStorage.getItem('wechatUserInfo');
            if (wechatUserInfo) {
                const userInfo = JSON.parse(wechatUserInfo);
                document.getElementById('wechat-avatar').src = userInfo.avatar;
                document.getElementById('wechat-nickname').textContent = userInfo.nickname;
            } else {
                // 如果没有微信用户信息，返回登录页面
                window.location.href = 'login.html';
            }
        });
        
        // 登录并绑定
        document.getElementById('login-bind-btn').addEventListener('click', function() {
            window.location.href = 'wechat-login-bind.html';
        });
        
        // 注册并绑定
        document.getElementById('register-bind-btn').addEventListener('click', function() {
            window.location.href = 'wechat-register-bind.html';
        });
    </script>

    <style>
        .wechat-user-info {
            text-align: center;
            margin-bottom: 40px;
            padding: 30px 20px;
            background: white;
            border-radius: 16px;
            box-shadow: 0 4px 20px rgba(0,0,0,0.08);
        }
        
        .wechat-avatar {
            width: 80px;
            height: 80px;
            margin: 0 auto 15px;
            border-radius: 50%;
            overflow: hidden;
            border: 3px solid #07C160;
        }
        
        .wechat-avatar img {
            width: 100%;
            height: 100%;
            object-fit: cover;
        }
        
        .wechat-nickname {
            font-size: 20px;
            font-weight: 600;
            color: #2d3748;
            margin-bottom: 10px;
        }
        
        .bind-tip {
            font-size: 14px;
            color: #718096;
        }
        
        .bind-options {
            width: 100%;
        }
        
        .bind-option {
            background: white;
            border-radius: 16px;
            padding: 25px 20px;
            margin-bottom: 20px;
            text-align: center;
            box-shadow: 0 4px 20px rgba(0,0,0,0.08);
        }
        
        .bind-option h3 {
            font-size: 18px;
            font-weight: 600;
            color: #2d3748;
            margin-bottom: 10px;
        }
        
        .bind-option p {
            font-size: 14px;
            color: #718096;
            margin-bottom: 20px;
        }
    </style>
</body>
</html>